package com.alcloud.springplus.domain;

import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @className: Org
 * @description: 组织结构表
 * @author: AllG
 * @createDate: 2018-12-13 11:13:17
 * @updateRemark: 更新说明
 */
@Data
@Entity
@Table(name = "t_org")
public class Org implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 主键Id
     */
    @Id
    @Column(name = "f_org_id", unique = true, nullable = false)
    @TableGenerator(name = "table_seq", pkColumnValue = "t_org", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "table_seq")
    private Integer id;

    /**
     * 组织父主键ID
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_parent_id")
    private Org parent;

    /**
     * 组织类型
     */
    @Column(name = "f_type", nullable = false, length = 50)
    private String type;

    /**
     * 组织名称
     */
    @Column(name = "f_name", nullable = false, length = 100)
    private String name;

    /**
     * 组织全称
     */
    @Column(name = "f_full_name", length = 150)
    private String fullName;

    /**
     * 组织描述
     */
    @Column(name = "f_description", length = 255)
    private String description;

    /**
     * 树编码
     */
    @Column(name = "f_tree_number", nullable = false, length = 100)
    private String treeNumber;

    /**
     * 树等级
     */
    @Column(name = "f_tree_level", nullable = false)
    private Integer treeLevel;

    /**
     * 树子节点最大编码
     */
    @Column(name = "f_tree_max", length = 10)
    private String treeMax;

    /**
     * 排序
     */
    @Column(name = "f_seq")
    private Integer seq;

    /**
     * 组织状态
     * 0：启用
     * 1：停用
     */
    @Column(name = "f_status")
    private Integer status;

    /**
     * 创建时间
     */
    @Column(name = "f_create_time", nullable = false)
    @CreationTimestamp
    private Date createTime;

    /**
     * 创建人
     */
    @Column(name = "f_create_by")
    private Integer createBy;

    /**
     * 更新时间
     */
    @Column(name = "f_update_time")
    private Date updateTime;

    /**
     * 更新人
     */
    @Column(name = "f_update_by")
    private Integer updateBy;
}
